home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / database / clippc / clip_c.h < prev    next >
Text File  |  1988-03-02  |  4KB  |  119 lines

  1. /***
  2. *   CLIP_C.h
  3. *
  4. *   DEFINEs and EXTERNs for interfacing with Clipper from C.
  5. *
  6. *   Large model C only (double word pointers to code and data)
  7. *
  8. *   Copyright (c) Nantucket Corporation 1987
  9. *
  10. *   Note: This is a modified version of EXTEND.H and NANDEF.H.
  11. *         This is ONLY an example of how EXTEND.H and NANDEF.H
  12. *         could be modified and is not supplied as a replacement,
  13. *         due to possible copyright restrictions.  Note that
  14. *         Nantucket still holds the copyright, even though
  15. *         they didn't make the mods.
  16. *
  17. */
  18.  
  19.  
  20. /* Clipper func/proc function in C */
  21.    #define CLIPPER      void pascal
  22.  
  23. /* Clipper Data types in c */
  24.    typedef char *CL_c ;       /* CL_c     string                    */
  25.    typedef int CL_csiz ;      /* CL_csiz  string siz                */
  26.    typedef int CL_clen ;      /* CL_clen  string len                */
  27.    typedef int CL_ni ;        /* CL_ni    numeric integer           */
  28.    typedef long CL_nl ;       /* CL_nl    numeric long              */
  29.    typedef double CL_nd ;     /* CL_nd    numeric double            */
  30.    typedef int CL_l ;         /* CL_l     logical                   */
  31.    typedef char *CL_ds ;      /* CL_ds    date string   YYYYMMDD    */
  32.    typedef unsigned char *CL_mptr ;
  33.                               /* CL_mptr  memory ptr                */
  34.    typedef unsigned CL_msiz ; /* CL_msiz  memory size (in bytes)    */
  35.    typedef int CL_par ;       /* CL_par   parameter (order or count */
  36.    typedef int CL_ai ;        /* CL_ai    array index               */
  37.  
  38. /* _parinfo types */
  39.    #define UNDEF        0
  40.    #define CHARACTER    1
  41.    #define NUMERIC      2
  42.    #define LOGICAL      4
  43.    #define DATE         8
  44.    #define ALIAS       16
  45.    #define MPTR        32      /* or'ed with type when passed by reference */
  46.    #define MEMO        65
  47.    #define WORD       128
  48.    #define ARRAY      512
  49.  
  50. /* parameter count/type */
  51.    extern CL_par _parinfo(CL_par) ;
  52.    extern CL_par _parinfa(CL_par, CL_ai) ;
  53.  
  54. /* Clipper-parameter functions */
  55.    extern CL_c    _parc(CL_par, ...) ;
  56.    extern CL_csiz _parcsiz(CL_par, ...) ;
  57.    extern CL_clen _parclen(CL_par, ...) ;
  58.    extern CL_ni   _parni(CL_par, ...) ;
  59.    extern CL_nl   _parnl(CL_par, ...) ;
  60.    extern CL_nd   _parnd(CL_par, ...) ;
  61.    extern CL_l    _parl(CL_par, ...) ;
  62.    extern CL_ds   _pards(CL_par, ...) ;
  63.  
  64. /* Clipper-function return values */
  65.    extern void _retc(CL_c) ;
  66.    extern void _retclen(CL_c, CL_clen) ;
  67.    extern void _retni(CL_ni) ;
  68.    extern void _retnl(CL_nl) ;
  69.    extern void _retnd(CL_nd) ;
  70.    extern void _retl(CL_l) ;
  71.    extern void _retds(CL_ds) ;
  72.  
  73. /* Clipper procedure return */
  74.    extern void _ret(void);
  75.  
  76. /* Clipper memory allocation */
  77.    extern CL_mptr _exmgrab(CL_msiz) ; /* size is in bytes */
  78.    extern void _exmback(CL_mptr, CL_msiz);
  79.  
  80. /* misc */
  81.    extern CL_clen strlen(CL_c) ;
  82.  
  83. /* parameter check macros */
  84.    #define PCOUNT      (_parinfo(0))
  85.    #define ISCHAR(n)   (_parinfo(n) & CHARACTER)
  86.    #define ISNUM(n)   (_parinfo(n) & NUMERIC)
  87.    #define ISLOG(n)   (_parinfo(n) & LOGICAL)
  88.    #define ISDATE(n)   (_parinfo(n) & DATE)
  89.    #define ISMEMO(n)   (_parinfo(n) & MEMO)
  90.    #define ISBYREF(n)   (_parinfo(n) & MPTR)
  91.    #define ISARRAY(n)   (_parinfo(n) & ARRAY)
  92.    #define ALENGTH(n)   (_parinfa(n, 0))
  93.  
  94. /* Nantucket defines (in nandef.h) */
  95.    #define FALSE   0
  96.    #define TRUE   1
  97.  
  98.    #define NIL      '\0'
  99.    #define NULL   0L
  100.  
  101. /* Header structure */
  102.    typedef unsigned char byte;
  103.    typedef unsigned int quant;
  104.    typedef int Boolean;
  105.  
  106.    typedef struct
  107.       {
  108.          byte signature;      /* 03 = dbf, 83 dbf+dbt */
  109.          byte ymd[3];      /* y+1900 m d */
  110.          long last_rec;
  111.          quant data_off;
  112.          quant rec_size;
  113.          byte pad[20];
  114.       } DBF_HEADER;
  115.  
  116.    extern DBF_HEADER *_dbfhead();
  117.    extern int _dbfopen();
  118.  
  119.